package openvpn

import (
	log "github.com/sirupsen/logrus"
	"os"
	"vpn/app/utils/file_handle"
)

func createShellScriptTemplate(filePath string, template string, overWrite bool) {

	// 判断文件是否存在
	exist, err := file_handle.Exists(filePath)
	if err != nil {
		log.Error("os error: %v", err)
	}
	if !exist || overWrite {
		err := os.WriteFile(filePath, []byte(template), 0755)
		if err != nil {
			log.Error("Failed to write to %v file: %v", filePath, err)
		}
	}
}
